
local M = _G.CommonOHOH.class.new(script, script.Parent.base,"mall_handle_"..script.Name);
function M.new(self,...)
	return M(self,...);
end;

function M.ctor(self, parent)
	M.super.ctor(self, parent)
end;

function M.dtor(self)
	M.super.dtor(self);
end;

--检查是否能够购买（子类去覆盖） (服务器，客户端都会调用)
function M.Check(self,gid,gtype)

	local cfg=_G.CommonOHOH.config.Goods[gid]
	local count=0
    for k,v in pairs(cfg.itemData) do
		count=count+v
    end
	return _G.CommonOHOH.load.PetTool().IsCanPlacedPet(count,self.DataBase) --判断背包是否满了
end

function M.IsMe(self,gid,gtype)
    return  script.Name==gtype
end

--服务器验证购买完成，处理发放逻辑（子类去覆盖）
function M.ServerBuyDone(self,gid,gtype,...)
    self.player.CanNotRobuxBuyEvent:Connect()
	local cfg=_G.CommonOHOH.config.Goods[gid]
	local count=0
	local eggId=nil
    for k,v in pairs(cfg.itemData) do
		count=count+v
		eggId=k
    end
	-- print("-------ServerBuyDone--------",gid,eggId)
	self.player:GetComponent(_G.CommonOHOH.load.Common_PetCtrl()):HatchEgg(eggId,count)
end


return M